<!doctype html>
<html class="no-js" lang="en">
<!--<![endif]-->
<head>
<meta name="layout" content="common">
<title>Manage Deals</title>
</head>
<body id="body">
	<h2>Manage Deals - Create</h2>
	<hr />
	<g:if test="${flash.message}">
		<div class="alert alert-success">
			<img src="${resource(dir:'images', file:'icon_successful.png') }" />&nbsp;&nbsp;${flash.message}
		</div>
	</g:if>
	
	<div class="row>">
		<g:form name="createDeal" method="POST" action="create">
			
			<table width="100%">
				<tr>
					<td width="30%">Title&nbsp;<font color="red">*</font></td>
					<td>
						<g:textField name="title" value="${dealInstance.title}" maxLength="100" style="width:220px;"/>
						<span class="errorMsg"><br/><g:fieldError bean="${dealInstance}" field="title" /></span>
					</td>
				</tr>
				<tr>
					<td>Country&nbsp;<font color="red">*</font></td>
					<td>
						<g:select name="country.id" from="${com.mastercard.labs.Country.list()}" optionKey="id" optionValue="name" value="${dealInstance?.country?.id}" />
						<span class="errorMsg"><br/><g:fieldError bean="${dealInstance}" field="country" /></span>
					</td>
				</tr>
				<tr>
					<td>Merchant</td>
					<td>
						<g:select name="merchant.id" from="${com.mastercard.labs.Merchant.list()}" optionKey="id" optionValue="name" value="${dealInstance.merchant?.id}" noSelection="${['':'Select One...']}"/>
						<span class="errorMsg"><br/><g:fieldError bean="${dealInstance}" field="merchant?.id" /></span>
					</td>
				</tr>
				<tr>
					<td>Categories</td>
					<td>
						<g:select name="categories" multiple="true" from="${com.mastercard.labs.Category.list()}" optionKey="id" optionValue="name" value="${dealInstance.categories?.id}" noSelection="${['':'Select One...']}"/>
						<span class="errorMsg"><br/><g:fieldError bean="${dealInstance}" field="categories?.id" /></span>
					</td>
				</tr>
				<tr>
					<td>Start Date&nbsp;<font color="red">*</font></td>
					<td>
						<calendar:datePicker name="startDate" value="${dealInstance.startDate}" />
						<span class="errorMsg"><br/><g:fieldError bean="${dealInstance}" field="startDate" /></span>
					</td>
				</tr>
				<tr>
					<td>End Date&nbsp;<font color="red">*</font></td>
					<td>
						<calendar:datePicker name="endDate" value="${dealInstance.endDate}"/>
						<span class="errorMsg"><br/><g:fieldError bean="${dealInstance}" field="endDate" /></span>
					</td>
				</tr>
				<tr>
					<td>Price&nbsp;<font color="red">*</font></td>
					<td>
						<g:textField name="price" value="${dealInstance.price}" maxLength="10" style="width:220px;"/>
						<span class="errorMsg"><br/><g:fieldError bean="${dealInstance}" field="price" /></span>
					</td>
				</tr>
				<tr>
					<td>Description</td>
					<td>
						<g:textArea name="description" value="${dealInstance.description}" rows="5" style="resize: none; width: 220px;"></g:textArea>
						<span class="errorMsg"><br/><g:fieldError bean="${dealInstance}" field="description" /></span>
					</td>
				</tr>
				<tr>
					<td>ImageUrl</td>
					<td>
						<g:textField name="imageUrl" value="${dealInstance.imageUrl}" maxLength="255" style="width:220px;"/>
						<span class="errorMsg"><br/><g:fieldError bean="${dealInstance}" field="imageUrl" /></span>
					</td>
				</tr>
				<tr>
					<td>DetailUrl</td>
					<td>
						<g:textField name="detailUrl" value="${dealInstance.detailUrl}" maxLength="255" style="width:220px;"/>
						<span class="errorMsg"><br/><g:fieldError bean="${dealInstance}" field="detailUrl" /></span>
					</td>
				</tr>
				<tr>
					<td>Tags</td>
					<td>
						<g:textField name="tags" value="${dealInstance.tags}" maxLength="100" style="width:220px;"/>
						<span class="errorMsg"><br/><g:fieldError bean="${dealInstance}" field="tags" /></span>
					</td>
				</tr>
				<tr><td>&nbsp;</td></tr>
				<tr>
					<td></td>
					<td>
						<g:actionSubmit action="save" value="Save" class="btn btn-primary" />
						<g:actionSubmit action="list" value="Cancel" class="btn" onclick="return confirm('Any changes made will be lost without saving. Are you sure you want to cancel?');" />
					</td>
				</tr>
			</table>
		</g:form>
	</div>
</body>
</html>
